﻿<navigation:PageView x:Class="Corina.Cydee.Apphub.Views.Documents.GuobiaoView"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:controls="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:localViewmodel="clr-namespace:Corina.Cydee.Apphub.Viewmodels"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:navigation="clr-namespace:Corina.Cydee.Apphub.Base"
                     xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                     xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                     d:DesignHeight="480"
                     d:DesignWidth="640"
                     mc:Ignorable="d">
    <navigation:PageView.DataContext>
        <localViewmodel:GuobiaoDocumentViewmodel />
    </navigation:PageView.DataContext>
    <Grid x:Name="LayoutRoot">
        <Grid Visibility="{Binding ShowUploadView, Converter={StaticResource BooleanToVisibilityInverseConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="300" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock VerticalAlignment="Center" Text="关键字：" />
                <controls:TextBoxExt Grid.Column="1" PlaceText="国标码、文件名、描述等" />
                <ToggleButton Grid.Column="3"
                              Content="上传文件"
                              IsChecked="{Binding ShowUploadView,
                                                  Mode=TwoWay}"
                              Padding="24,0" />
            </Grid>

            <toolkit:BusyIndicator Grid.Row="1" IsBusy="{Binding IsBusy}">
                <sdk:DataGrid Margin="0,12"
                              AutoGenerateColumns="False"
                              ItemsSource="{Binding ItemsCollection}">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Binding="{Binding ItemIndex}" Header="序号" />
                        <sdk:DataGridTextColumn Binding="{Binding Name}" Header="名称" />
                        <sdk:DataGridTextColumn Binding="{Binding Code}" Header="编号" />
                        <sdk:DataGridTextColumn Binding="{Binding Filename}" Header="文件名" />
                        <sdk:DataGridTextColumn Binding="{Binding Description}" Header="描述" />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
            </toolkit:BusyIndicator>
        </Grid>

        <toolkit:BusyIndicator IsBusy="{Binding Uploading}" Visibility="{Binding ShowUploadView, Converter={StaticResource BooleanToVisibilityConverter}}">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="350" />
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Column="1">
                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBox VerticalAlignment="Center"
                                     IsReadOnly="True"
                                     Text="{Binding ChooseFile.FullName,
                                                    Mode=OneWay}" />
                            <Button Grid.Column="1"
                                    Command="{Binding OpenDialogCommand}"
                                    Content="浏览" />
                        </Grid>
                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="文件名：" />
                            <TextBlock Grid.Column="1" Text="{Binding ChooseFile.Name}" />
                        </Grid>

                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="文件大小：" />
                            <TextBlock Grid.Column="1" Text="{Binding ChooseFile.Length}" />
                        </Grid>

                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="文件创建时间：" />
                            <TextBlock Grid.Column="1" Text="{Binding ChooseFile.CreationTime}" />
                        </Grid>

                        <Rectangle Height="1"
                                   Margin="0,0,0,12"
                                   Fill="{StaticResource GrayBrush1}" />

                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock VerticalAlignment="Center" Text="国标代码：" />
                            <TextBox Grid.Column="1" Text="{Binding GBCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </Grid>

                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock VerticalAlignment="Center" Text="标准名称：" />
                            <TextBox Grid.Column="1" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </Grid>

                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock VerticalAlignment="Center" Text="重命名文件：" />
                            <TextBox Grid.Column="1" Text="{Binding Filename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </Grid>
                        <Grid Margin="0,0,0,12">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <TextBlock VerticalAlignment="Center" Text="描述：" />
                        </Grid>
                        <TextBox Height="100"
                                 Margin="0,0,0,12"
                                 VerticalContentAlignment="Stretch"
                                 AcceptsReturn="True"
                                 Text="{Binding Description,
                                                Mode=TwoWay,
                                                UpdateSourceTrigger=PropertyChanged}"
                                 TextWrapping="Wrap" />
                    </StackPanel>

                    <Grid Grid.Row="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="auto" />
                        </Grid.ColumnDefinitions>

                        <Button MinHeight="30"
                                HorizontalAlignment="Left"
                                Command="{Binding UploadCommand}"
                                Content="开始上传"
                                Padding="24,0" />

                        <Button Grid.Column="1"
                                MinWidth="60"
                                Command="{Binding CancelCommand}"
                                Content="取消" />
                    </Grid>



                </Grid>
            </Grid>
        </toolkit:BusyIndicator>
    </Grid>
</navigation:PageView>
